#!/bin/bash

# 检查nis-server是否已安装
if rpm -q nis-server &>/dev/null; then
    echo "[-] 检测失败: nis-server已安装"
    
    # 显示已安装的NIS相关包
    echo "    已安装的NIS相关包:"
    rpm -qa | grep -E "(nis|ypserv)" | sed 's/^/    /'
    
    # 检查服务状态
    if systemctl is-active ypserv &>/dev/null; then
        echo "    ypserv服务正在运行"
    fi
    
    exit 1
else
    echo "[+] 检测通过: nis-server未安装"
    exit 0
fi